	/************************************************************************
	*	HISR - Keypad
	*	
	*	@brief	- allows the external interrupt to be chosen.
	*			- allows the input pins for keypad to be selected from PORTB
	*			- allows the keys for the basic commands to be mapped
	* 			- allows the sequence of keys for advanced commands to be customised
	*			- includes function to initialise the keypad
	*			- includes the interrupt routine
	*
	*	@author		Felix Ossig-Bonanno
	*	@file       hisr_keypad.h
	*	@ver		1.0 (initial keypad release)
	*
	*************************************************************************/

///////////////////////////////////
///   KEYPAD CONNECTION CONFIG   //
///////////////////////////////////
#define INT1					//selects what external interrupt to use for keypad (choose INT0:2 - Number corresponds to PORTB pin)
#define INPUTMASK 0b01111000 	//select the input pins (portB) for keyboard (must be consecutive!)
#define N 3 					//number of first input to pic - predetermined by chosen INPUTMASK

///////////////////////////////////
///   COMMANDS                   //
///////////////////////////////////

///   basic commands
//correspond to the button on the keypad
#define CMD_SHOW_MODE 		'1'	//show mode
#define CMD_SHOW_DIST 		'2' //show distance
#define CMD_SHOW_TEMP 		'3'	//show temp
#define CMD_CONTINUOUS		'4' //toggle single OR continuous measurments
#define CMD_METRIC			'5' //toggle metric OR imperial display
#define CMD_ADVANCED 		'*' //enable (a single) advanced command

///   advanced commands
//adv cmds are a sequence of key presses entered AFTER the '*' key is pressed
#define ADV_CMD_MAXLEN	4	//Max length of adv cmds
//correspond to the sequence of buttons pressed. Cannot be longer than ADV_CMD_MAXLEN
#define ADV_CMD_FACTORY 					"1111"	
#define ADV_CMD_USER						"2222"
#define ADV_CMD_SAMPLES_PER_MEASURMENT 		"4444"	//FIX - not implemented
#define ADV_CMD_TIME_BETWEEN_SAMPLES 		"5555"	//FIX - not implemented
#define ADV_CMD_RANGE_GATE					"7777"	//FIX - not implemented
#define ADV_CMD_SHOW_RANGE_READINGS			"8888"
#define ADV_CMD_SHOW_STATISTICS				"0000"
#define ADV_CMD_TEMP_CELCIUS				"1212"
#define ADV_CMD_TEMP_FARENHEIT				"4545"

///////////////////////////////////
///   FUNCTIONS                  //
///////////////////////////////////
void init_keypad(void); //initialises the interupt for the keypad - to be used in main.c
void hisr_keypad(void); //routine for keypad interrupt - to be used in the high priority interrupt

